//package com.jdd.modules.mqtt.server.revice;
//
//import com.alibaba.fastjson.JSONObject;
//import com.jdd.common.constant.FaceConstant;
//import com.jdd.modules.device.entity.TDevice;
//import com.jdd.dao.service.TDeviceStatusService;
//import com.jdd.modules.device.service.TDeviceService;
//import org.apache.commons.lang3.StringUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * @program: jdd-people-passage
// * @ClassName ReciveMqttQrResponseService
// * @description: mqtt上线topic消息处理类
// * @author: zsj
// * @create: 2022-03-24 09:56
// * @Version 1.0
// **/
//@SuppressWarnings("DuplicatedCode")
//@Service("mqttOnlineResponseStrategy")
//public class ReciveMqttOnlineResponseServiceStrategy implements IReciveMqttBaseStrategy {
//    private Logger logger = LoggerFactory.getLogger(this.getClass());
//
//    @Autowired
//    private TDeviceStatusService deviceStatusService;
//    @Autowired
//    private TDeviceService deviceService;
//
//    /**
//     * 处理从mqtt接收到的设备上线消息接口
//     *
//     * @param message 消息
//     * @return void
//     * @Description
//     * @Author zsj
//     * @Date 2022-03-24 9:53
//     **/
//    @Override
//    public void handleMessage(String message) {
//        logger.info("接收到设备上线消息，消息：{}", message);
//        JSONObject jsonObject = JSONObject.parseObject(message);
//        String sn = jsonObject.getString("sn");
//        if (StringUtils.isBlank(sn)) {
//            return;
//        }
//        TDevice device = deviceService.getDeviceBySn(sn);
//        if (null == device) {
//            //未知设备 不进行处理
//            logger.info("未知设备，不进行处理");
//            return;
//        }
//        deviceStatusService.updateDeviceStatus(FaceConstant.DEVICE_STATUS_ONLINE, device);
//    }
//}